package cn.anosi.page;

import org.springframework.data.domain.Sort.Direction;

/**
 * @Description: 分页对象
 * @author 刘彦硕
 * @date 2017年1月9日 下午5:08:33
 */
public class Pager {
	private Integer draw;//请求次数
	private Integer pageNum;//当前页码
	private Integer pageSize;//每页显示多少条记录
	private String property; //排序字段
	private String direction; //升序降序

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getDraw() {
		return draw;
	}

	public void setDraw(Integer draw) {
		this.draw = draw;
	}

	public String getProperty() {
		return property;
	}

	public void setProperty(String property) {
		this.property = property;
	}

	public Direction getDirection() {
		if("asc".equals(this.direction)){
			return Direction.ASC;
		}
		
		if("desc".equals(this.direction)){
			return Direction.DESC;
		}
		
		return Direction.ASC;
	}

	public void setDirection(String direction) {
		this.direction = direction;
	}

	@Override
	public String toString() {
		return "Pager [draw=" + draw + ", pageNum=" + pageNum + ", pageSize=" + pageSize + ", property=" + property
				+ ", direction=" + direction + "]";
	}
	
}
